//
//  BVShareManager.m
//  BuyVegetable
//
//  Created by yushanchang on 16/11/7.
//  Copyright © 2016年 com.yinding. All rights reserved.
//

#import "BVShareManager.h"

//share SDK
#import <ShareSDK/ShareSDK.h>
#import <ShareSDKConnector/ShareSDKConnector.h>

//腾讯开放平台（对应QQ和QQ空间）SDK头文件
#import <TencentOpenAPI/TencentOAuth.h>
#import <TencentOpenAPI/QQApiInterface.h>

//微信SDK头文件
#import "WXApi.h"

//新浪微博SDK头文件
#import "WeiboSDK.h"
//新浪微博SDK需要在项目Build Settings中的Other Linker Flags添加"-ObjC"

@implementation BVShareManager

+ (void)initSocialShareSDK {

    [ShareSDK registerApp:@"iosv1101" activePlatforms:@[
            @(SSDKPlatformTypeSinaWeibo),
            @(SSDKPlatformSubTypeWechatTimeline),
            @(SSDKPlatformSubTypeWechatSession),]
     
       onImport:^(SSDKPlatformType platformType)
     {
         switch (platformType)
         {
             case SSDKPlatformTypeWechat:
                 [ShareSDKConnector connectWeChat:[WXApi class]];
                 break;
                 
             case SSDKPlatformTypeQQ:
                 [ShareSDKConnector connectQQ:[QQApiInterface class] tencentOAuthClass:[TencentOAuth class]];
                 break;
                 
             case SSDKPlatformTypeSinaWeibo:
                 [ShareSDKConnector connectWeibo:[WeiboSDK class]];
                 break;
                 
             default:
                 break;
         }
     }
          onConfiguration:^(SSDKPlatformType platformType, NSMutableDictionary *appInfo)
     {
         
         switch (platformType)
         {
             case SSDKPlatformTypeSinaWeibo:
                 //设置新浪微博应用信息,其中authType设置为使用SSO＋Web形式授权
                 [appInfo SSDKSetupSinaWeiboByAppKey:@"1599799453" appSecret:@"152faf07c0970acce99cd14c4eaa8275" redirectUri:@"http://www.sharesdk.cn" authType:SSDKAuthTypeBoth];
                 break;
                 
             case SSDKPlatformTypeWechat:
                 [appInfo SSDKSetupWeChatByAppId:@"wx6e1d9f7980a2aea8" appSecret:@"5d0503713b288d706a461172de3ec19e"];
                 break;
                 
             case SSDKPlatformTypeQQ: [appInfo SSDKSetupQQByAppId:@"100371282" appKey:@"aed9b0303e3ed1e27bae87c33761161d" authType:SSDKAuthTypeBoth];
                 break;
                 
             default:
                 break;
         }
     }];
}

#warning share for title/content/image/url...!!!
+(BOOL)shareTitle:(NSString *)title content:(NSString *)content URL:(NSString *)url images:(NSArray *)images onShareStateChanged:(void (^)(bool))shareStateChanged {
    return NO;
}

@end
